package com.example.aicloud.utils;

import com.example.aicloud.entity.SecurityUserDetails;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * @author Mr.Tang
 * @date 2024-07-18
 */
public class SecurityUtil {


    /**
     * 得到当前登录用户
     * @return
     */
    public static SecurityUserDetails getCurrentUser() {
        return (SecurityUserDetails) SecurityContextHolder.getContext()
                .getAuthentication().getPrincipal();
    }

}
